#include "StdAfx.h"
#include "cln_conn_manager.hpp"

namespace fly {

	namespace jld{

		namespace client
		{
			void connection_manager::start(connection_ptr c)
			{
				connections_.insert(c);
				LOG_PRINTF("Connection size: %d",connections_.size());
				c->start();
			}

			void connection_manager::stop(connection_ptr c)
			{
				connections_.erase(c);
				LOG_PRINTF("Connection size: %d",connections_.size());
				c->stop();
			}

			void connection_manager::stop_all()
			{
				std::for_each(connections_.begin(),connections_.end()
					,boost::bind(&connection::stop,_1));
				connections_.clear();
			}
			const size_t connection_manager::connection_size()
			{
				return connections_.size();
			}
		}

	}
}